#include "ThreadPool.h"
#include "Task.h"

void testAddTask(ThreadPool<Task> *tp, int num, int speed)
{
    for (int i = 0; i < num; ++i)
    {
        Task *task = new Task(i);
        tp->AddTask(task);
        usleep(1000 * speed); // speed ms
    }
}

int main()
{
    ThreadPool<Task> *tp = new ThreadPool<Task>(7, 3, 10);

    // sleep(5);
    testAddTask(tp, 5, 1000);
    sleep(3);
    testAddTask(tp, 100, 1);
    // testAddTask(tp, 10, 500);
    // testAddTask(tp, 10, 1000);

    delete tp;
    return 0;
}
